/*
 * thread.c
 *
 *  Created on: 10.01.2013
 *      Author: phru
 */

#include <stdlib.h>
#include "thread.h"

/**
 * Starts the first thread
 */
void runThread1(void){
	P1DIR |= BIT0;

	while(1){
		P1OUT = BIT0;
	}
}

/**
 * Starts the second thread
 */
void runThread2(void){
	P1DIR |= BIT0;

	while(1){
		P1OUT = BIT0;
	}
}

/**
 * Create thread 1
 */
thread_t* createThread1(uint16_t id){
	thread_t* thread = malloc(sizeof(thread_t*));
	thread->run = runThread1;
	thread->id = id;
	thread->state = THREAD_READY;
	return thread;
}

/**
 * Create thread 2
 */
thread_t* createThread2(uint16_t id){
	thread_t* thread = malloc(sizeof(thread_t*));
	thread->run = runThread2;
	thread->id = id;
	thread->state = THREAD_READY;
	return thread;
}
